_onCapturedEvent(actor, event) {
if (event.type() === Clutter.EventType.BUTTON_PRESS) {
- let source = event.get_source();
- if (source !== this._text &&
+ const targetActor = global.stage.get_event_actor(event);
+ if (targetActor !== this._text &&
this._text.has_key_focus() &&
this._text.text === '' &&
!this._text.has_preedit() &&
- !Main.layoutManager.keyboardBox.contains(source)) {
+ !Main.layoutManager.keyboardBox.contains(targetActor)) {
// the user clicked outside after activating the entry, but
// with no search term entered and no keyboard button pressed
// - cancel the search